#include <iostream>
#include <cmath>
#include "BinaryTree.h"
using namespace std;

// 99.95 %
class Solution
{
  public:
	int maxDepth(TreeNode *root)
	{
		if (root)
			return 1 + max(maxDepth(root->left), maxDepth(root->right));
		return 0;
	}
};

int main()
{
	int arr[] = {3, 9, 0, 0, 20, 15, 0, 0, 7, 0, 0};
	int n = sizeof(arr) / sizeof(arr[0]);
	TreeNode *tree = createBinaryTree(arr, n);
	preorderPrint(tree);
	cout << endl;
	cout << "deep=" << Solution().maxDepth(tree) << endl;
	return 0;
}
